Skip to content

Fix ext/mysql test failed - #174

Closed
reeze wants to merge 1 commit into
php:PHP-5.3from
reeze:fix-mysql-test
Closed

reeze wants to merge 1 commit into
php:PHP-5.3from
reeze:fix-mysql-test

Conversation

@reeze

@reeze reeze commented Aug 21, 2012

Copy link
Copy Markdown
Contributor

In ext/mysql/tests/mysql_query_load_data_openbasedir.phpt

skipif section:

connect.inc was include before skipif.inc. but if mysql wasn't enabled. connect will fatal
because of missing function: mysql_get_client_info(). then skipif section output nothing.
this makes this tests didn't skip.

This is 5.3 only, since the patch could not directly been merged to 5.4/master.
I will send another PR.

@travisbot

Copy link
Copy Markdown

This pull request fails (merged 97601b8 into 92153dc).

@laruence

Copy link
Copy Markdown
Member

Hi, thanks for spoting this, but the connect.inc was already include in skipif.inc.

so, your fix is still mess, I can not merge it. I fixed by hand.

@reeze reeze closed this Aug 21, 2012
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
…rflow

Problem: `==` on a struct that holds itself, as `Node? next` or
`List<Tree> branches`, crashed `mago compile` with a stack overflow.
`struct_property_refusal` keeps the structs it is checking, and stops at
one it meets again, but it checked each property's type through
`sharp_refusal`, which started that list afresh, as `collection_refusal`
did for a list's elements. PR php#174's patch-coverage run found 60 struct
lines no test ran; a probe for one of them hit the crash. The rest were
rules with no row, arms no program reaches, and a backing-type arm left
from before a struct's header named interfaces only.

Solution: `refusal` is `sharp_refusal` inside the structs being checked,
and the struct and collection branches pass that list on, so a struct
compares by the rest of its properties. Every rule the run found unrun
has its row: each property `==` can't compare and why, a list of
structs or of lists, a search of structs, a `new` or `with` of no
struct, a header naming no type, a struct declared twice, a struct's
constant, named constructor, law, attribute and `self`, and `parse` of a
function, an `Any`, a `bool`, an `int`-backed enum, a pure enum, a list
of lists of `Set`s and `Point|List<Point>`. The arms no program reaches
are deleted: a named `Closure`, which PHP# writes as a function type, a
named enum, which the codex gives as an enum, `Object`, which PHP# has
no type for yet, and a struct's backing type. An impossible arm is an
`unreachable!` with its reason. The struct property message takes "an"
before a vowel, as "`data` is an `Any`".

On the slot 8 engine, `==` on equal chains of `Node` and trees of
`Tree` gives true, and on chains or trees that differ in a value, a
`null` or a depth gives false.

crates/analyzer/src/
├── expression/binary/comparison.rs       <- refusal threads `visiting` through structs and collections;
│                                            struct_property_issue's article
├── statement/class_like/struct.rs        <- analyze_struct, as analyze_event; report_class_held_by_key reads
│                                            the structs a key names; the Closure and named enum arms deleted
└── statement/class_like/initialization.rs <- a declared property's name span is unreachable! when missing
crates/semantics/src/internal/checker/sharp.rs <- the struct backing-type arm deleted; supported's struct note
                                                   is unreachable!, so it is no const fn
crates/sharp-bridge/src/lower/types.rs    <- the Object arm deleted
crates/analyzer/tests/sharp.rs            <- a_struct_compares_by_value, collections_compare_by_value,
                                             a_search_needs_equality_on_the_element_type,
                                             every_required_property_is_set_where_its_object_is_created,
                                             with_and_an_object_initializer_set_init_and_set_properties,
                                             a_struct_inherits_nothing_implements_interfaces_and_is_declared_once,
                                             a_struct_keys_a_map_unless_it_holds_a_class_instance,
                                             every_struct_parses_and_classes_do_not: the rows
crates/semantics/tests/sharp.rs           <- a_struct_takes_only_public, a_struct_member_is_private_where_a_class_
                                             would_be_protected, self_names_the_class_and_self_where_it_goes
crates/sharp-bridge/tests/lower.rs        <- parse_reads_each_field_as_its_type: six field types;
                                             a_struct_is_a_final_class_whose_op_equality_compares_each_property:
                                             a header interface
heyJordanParker added a commit to heyJordanParker/php-sharp that referenced this pull request Oct 13, 2026
… mutant has a row

Problem: PR php#174's mutants run left 17 mutants no test caught. One
was a real defect: a struct's `protected static Size operator +` got two
refusals, "A struct has no subclasses, so write `private`." and "An
operator is `public static`". The first fix doesn't compile, because
`check_operator` refuses every operator modifier but `public static`.
The other 16 were rules with no row that fails when the rule breaks: a
struct's other static method, a struct field nested in a struct, a
struct that holds itself in `parse`, an abstract class's get-only
property, a computed property of a key struct, a struct's `self` and
duplicate member, a struct's property field and a method parameter
named like a field in `parse`, and a struct two collections deep.

Solution: the struct member check reads no operator's modifiers, so
`check_operator` alone refuses them. Each mutant has a row that fails
under it. Three mutants are equivalent: `ZEND_ACC_PUBLIC |
ZEND_ACC_STATIC` as `^` gives the same flags, as the two are distinct
bits.

crates/semantics/src/internal/checker/sharp.rs <- check_struct_declaration reads no operator's modifiers
crates/analyzer/tests/sharp.rs            <- every_struct_parses_and_classes_do_not: Mind, Chain and
                                             Feeling.calm; a_get_only_property_no_constructor_sets_is_an_error:
                                             an abstract class; a_struct_keys_a_map_unless_it_holds_a_class_
                                             instance: a computed property
crates/semantics/tests/sharp.rs           <- a_struct_member_is_private_where_a_class_would_be_protected: a
                                             protected operator; self_names_the_class_and_self_where_it_goes:
                                             the struct first; a_member_defined_twice_and_its_class_are_named_
                                             as_sharp_writes_them: a struct
crates/sharp-bridge/tests/lower.rs        <- parse_reads_each_field_as_its_type: a property field, a method
                                             parameter named like a field, and List<List<Point>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants